// const express = require("express");
import express from 'express';
const app = express();
const port = 3000;

// Please install OpenAI SDK first: `npm install openai`

import OpenAI from "openai";

// 中间件：解析 JSON 格式的请求体
app.use(express.json());


const openai = new OpenAI({
        baseURL: 'https://api.deepseek.com',
        apiKey: 'sk-c5420c5261524e4182629e8a1d30e214'
});

async function main() {
  const completion = await openai.chat.completions.create({
    messages: [{ role: "system", content: "You are a helpful assistant." }],
    model: "deepseek-reasoner",
  });

  console.log(completion.choices[0].message.content);
}

// main();

app.get('/', (req, res) => {
  res.send('Hello, World!');
});

// app.get('/', (req, res) => {
//     res.send('Hello, World!');
//   });

app.listen(port, () => {
  console.log(`Server running at http://localhost:${port}/`);
});
